package org.jackysoft.service.impl;

import org.jackysoft.entity.HTMLDocument;
import org.jackysoft.entity.HTMLTemplate;
import org.jackysoft.service.AbstractStringIdServiceImpl;
import org.jackysoft.service.HTMLDocumentService;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service@Transactional
public class HTMLDocumentServiceImpl extends
AbstractStringIdServiceImpl<HTMLDocument> implements HTMLDocumentService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3599025570283252877L;

	
	public HTMLDocumentServiceImpl() {
         this.type = HTMLDocument.class;
	}


	


	@Override
	public int release(HTMLTemplate tmp)
			throws DataAccessException {
		String qs = "update "+this.entitytable()+" d set d.htmlTemplate=null where d.htmlTemplate.id='"+tmp.getId()+"'";
		int rows = getSession().createQuery(qs).executeUpdate();
	    return rows;
	}

}
